全部文档

5.4BACnet通道管理

提供了BACnet通道的增删改查、查询指定边缘节点下的所有通道、查询指定设备下的所有通道、创建BACnet设备的网关通道配置、查询BACnet设备的网关通道配置等功能。

5.4.1 创建BACnet通道

功能描述:新建一个通道,返回新建通道id。

POST  /api/v1/device/bacnet/channel/add

Body:

Name Type Description Required
gatewayid int 网关ID Yes
ifName string 网卡名称 Yes
name string 通道名 Yes
type int 传输模式: 1-IP Yes
created long 创建时间 No
modified long 修改时间 No

Body example:

{
  "gatewayid": "100201",
  "ifName": "测试",
  "name": "测试",
  "type": 1,
  "created": 1588838290399,
  "modified": 1588838290399
}

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/bacnet/channel/add?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "gatewayid": "100201",
              "ifName": "测试",
              "name": "测试",
              "type": 1,
              "created": 1588838290399,
              "modified": 1588838290399
            }'

Response data:

Name Type Description
id int 通道ID

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
    "id": 14
  }
}

5.4.2修改BACnet通道

功能描述:修改指定通道。

PUT  /api/v1/device/bacnet/channel/update

Body:

Name Type Description Required
id int 通道ID Yes
gatewayid int 网关ID Yes
ifName string 网卡名称 Yes
name string 通道名 Yes
type int 传输模式: 1-IP Yes

Body example:

{
  "id":14,
  "gatewayid": "100201",
  "ifName": "测试",
  "name": "测试",
  "type": 1
}

cURL example:

curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/bacnet/channel/update?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "id":14,
              "gatewayid": "100201",
              "ifName": "测试",
              "name": "测试",
              "type": 1
            }'

Response data:

Name Type Description
id int 通道ID
gatewayid int 网关ID
ifName string 网卡名称
name string 通道名
type int 传输模式: 1-IP
created long 创建时间
modified long 修改时间

Response example:

{
    "success": true,
    "code": 0,
    "msg": "",
    "data": {
       "id": 14,
       "gatewayid": 10000144,
       "ifName": "api_channel_01",
       "name": "testbacnet",
       "type": 1,
       "created": 1588838290399,
       "modified": 1588838290399
    }
}

5.4.3查询BACnet通道详情

功能描述:根据id查询指定通道,返回该通道的具体信息。

GET  /api/v1/device/bacnet/channel/{id}

Path:

Name Type Description Required
id int 通道ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/bacnet/channel/110?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
id int 通道ID
gatewayid int 网关ID
ifName string 网卡名称
name string 通道名
type int 传输模式: 1-IP
created long 创建时间
modified long 修改时间

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": [
    {
       "id": 14,
       "gatewayid": 10000144,
       "ifName": "api_channel_01",
       "name": "testbacnet",
       "type": 1,
       "created": 1588838290399,
       "modified": 1588838290399
    }
  ]
}

5.4.4查询边缘节点下的所有BACnet通道

功能描述:查询指定边缘节点下的所有通道,返回该通道信息列表。

GET  /api/v1/device/bacnet/channel/page

Query:

Name Type Description Required
gatewayId int 网关ID Yes
pageSize int 分页大小 Yes
currentPage int 页码 Yes
name string 设备名称(模糊匹配) No
masterUsername string 主用户名 No
username string 用户名 No

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/bacnet/channel/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&gatewayId=10000807&pageSize=10&currentPage=1' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 页码
pageSize int 每页条数(范围:1-50)
content struct[] 当前页内容
totalCount long 总条数
totalPage int 总页数

Response data content的子对象结构体:

Name Type Description
id int 通道ID
gatewayid int 网关ID
ifName string 网卡名称
name string 通道名
type int 传输模式: 1-IP
created long 创建时间
modified long 修改时间

Response example:

{
    "data": {
        "currentPage": 1,
        "pageSize": 5,
        "totalCount": 1,
        "totalPage": 1,
        "content": [{
                  "id": 14,
                  "gatewayid": 10000144,
                  "ifName": "api_channel_01",
                  "name": "testbacnet",
                  "type": 1,
                  "created": 1588838290399,
                  "modified": 1588838290399
                }
        ]
    },
    "success": true,
    "code": 0,
    "msg": null
}

5.4.5删除BACnet通道

功能描述:删除指定通道。

DELETE  /api/v1/device/bacnet/channel/{id}

Path:

Name Type Description Required
id int 通道ID Yes

cURL example:

curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/bacnet/channel/110?accessKeyId={accessKeyId}&signatureNonce=529&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": 1
}

5.4.6设置BACnet设备的边缘节点通道配置

功能描述:为BACnet设备创建一个网关通道配置,根据此配置可以实现该设备数据的上传和下发。

注意:此接口多次调用会覆盖旧的BACnet设备网关通道配置。

PUT  /api/v1/devices/bacnet/channel-config/gateway

Body:

Name Type Description Required
id int BACnet设备在本平台的ID Yes
channelId int 网关通道配置ID Yes
bacnetDeviceId int BACnet设备在BACnet网络中的设备ID号 Yes
collectTime int 设备数据采集间隔 Yes
discoveryMode int 通信方式:1-定向; 2-非定向 Yes
bacnetAddress string 地址, IP地址加端口号 Yes
maxAPDU int BACnet设备的max_apdu,单位为字节 Yes

Body example:

{
    "channelId": 192,
    "id": 10245603,
    "bacnetDeviceId": 12345,
    "discoveryMode": 1,
    "collectTime": 5,
    "bacnetAddress": "1.2.3.4:47808",
    "maxAPDU": 100
}

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/bacnet/channel-config/gateway?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "channelId": 192,
    "id": 10245603,
    "bacnetDeviceId": 12345,
    "discoveryMode": 1,
    "collectTime": 5,
    "bacnetAddress": "1.2.3.4:47808",
    "maxAPDU": 100
}'

Response example:

{
    "code": 0,
    "data": null,
    "msg": "成功",
    "success": true
}

5.4.7获取BACnet设备的边缘节点通道配置

功能描述:获取BACnet设备的网关通道配置。

GET  /api/v1/devices/bacnet/channel-config/gateway

Query:

Name Type Description Required
id int BACnet设备ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/bacnet/channel-config/gateway?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&id=10000807' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
id int BACnet设备在本平台的ID
channelId int 网关通道配置ID
bacnetDeviceId int BACnet设备在BACnet网络中的设备ID号
collectTime int 设备数据采集间隔
discoveryMode int 通信方式:1-定向; 2-非定向
bacnetAddress string 地址, IP地址加端口号
maxAPDU int BACnet设备的max_apdu,单位为字节

Response example:

{
    "code": 0,
    "data": {
        "collectTime": 5,
        "discoveryMode": 1,
        "maxAPDU": 101,
        "bacnetAddress": "1.2.3.4:47808",
        "id": 10000807,
        "bacnetDeviceId": 12345,
        "channelId": 192
    },
    "msg": "成功",
    "success": true
}

results matching ""

    No results matching ""